/* H5页面使用的api
 * H5Edit.js
 */
import {REQUEST_URL} from './Constants';
import {postFormData,getData,uploadFiles} from './HttpUtil';

export function createH5(pageData){
	return postFormData(REQUEST_URL.H5_SAVE_DATA,pageData)
	.then(res=>{
		return res.data;
	},err=>{
		console.log('api create h5 error');
		console.log(err);
	});
}

export function copyH5(params={}){
	return postFormData(REQUEST_URL.H5_COPY_DATA,params)
	.then(res=>{
		return res.data;
	},err=>{
		console.log('api copy h5 error');
		console.log(err);
	});
}

export function getH5Data(params={}){
	return getData(REQUEST_URL.H5_GET_DATA,params)
	.then(res=>{
		return res.data;
	},err=>{
		console.log('api h5 init data error');
		console.log(err);
	});
}

export function getPreviewContent(params={}){
	return getData(REQUEST_URL.H5_PREVIEW_CONTENT,params)
	.then(res=>{
		return res;
	},err=>{
		console.log('api h5 manage preview error');
		console.log(err);
	});
}

export function saveData(pageData){
	return postFormData(REQUEST_URL.H5_SAVE_DATA,pageData)
	.then(res=>{
		return res;
	},err=>{
		console.log('api h5 save data error');
		console.log(err);
	});
}
